package com.example.computer_exam_training_sys.service.impl;

import com.example.computer_exam_training_sys.entity.Feedback_Info;
import com.example.computer_exam_training_sys.mapper.User_feedbackMapper;
import com.example.computer_exam_training_sys.service.User_feedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class User_feedbackServiceImpl implements User_feedbackService {
    @Autowired
    private User_feedbackMapper user_feedbackMapper;

    @Override
    public List<Feedback_Info> selectAll() {
        return user_feedbackMapper.selectAll();
    }

    @Override
    public Feedback_Info selectByID(int feedback_id) {
        return user_feedbackMapper.selectByID(feedback_id);
    }

    @Override
    public int insertFeedback(Feedback_Info feedback) {
        return user_feedbackMapper.insertFeedback(feedback);
    }

    @Override
    public int updateFeedback(Feedback_Info feedback) {
        return user_feedbackMapper.updateFeedback(feedback);
    }

    @Override
    public int deleteFeedback(int feedback_id) {
        return user_feedbackMapper.deleteFeedback(feedback_id);
    }

    @Override
    public List<Feedback_Info> selectAllByPage(int page, int pageSize) {
        int offset = (page - 1) * pageSize;
        return user_feedbackMapper.selectAllByPage(offset, pageSize);
    }
}